class Solution(object):
    def hammingWeight(self, n):
        """
        :type n: int
        :rtype: int
        """
        byte_num = bin(n)[2:]
        res = 0
        for i in byte_num:
            if i == '1':
                res += 1
        return res